<?php
$user = $_POST['userL'];
$pass = $_POST['passwordL'];

$hostDB = "localhost";
$userDB = "ampersand";
$passDB = "palomitas";
$dbnameDB = "LYONUNO";

$canalDB = mysql_connect($hostDB, $userDB, $passDB);
$db = mysql_select_db($dbnameDB);
$consulta = "select * from USERS where nick='$user'";

$resDB = mysql_db_query($dbnameDB, $consulta,$canalDB);

$row = mysql_fetch_object($resDB);

mysql_close($canalDB);

if ($row->pass == $pass && $pass != ''){
	setCookie("loggedIn","$user",(time()+(60*60*24)));
	header('Location: /main.php?');
}else
	header('Location: /main.php?page=login.html');

?>

